<?php
/**
 * @package     Joomla.Libraries
 * @subpackage  Form
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined( '_JEXEC' ) or die( 'Restricted access' );

/**
 * Field to select a user id from a modal list.
 *
 * @package     Joomla.Libraries
 * @subpackage  Form
 * @since       1.6.0
 */
class JFormFieldUsers extends JFormFieldUser
{
	//protected $type = 'Users';

	protected function getExcluded()
	{
		$db = JFactory :: getDBO();

		$query = "SELECT u.id FROM #__users u LEFT JOIN #__congregation_profile m ON u.id = m.uid WHERE m.uid IS NOT NULL AND m.published IN (0, 1) AND u.id <> '" . $this->value . "'";
		$db->setQuery( $query );
		$rst = $db->loadObjectList();
		$rows = array();
		foreach ($rst as $row)
		{
			$rows[] = $row->id;
		}
		
		if(!empty($rows))
		{
			return $rows;
		}
		return null;
	}
}